use std::ops;

#[derive(Debug)]
struct Foo;

#[derive(Debug)]
struct Bar;

#[derive(Debug)]
struct FooBar;

impl ops::Add<Bar> for Foo {
    type Output = FooBar;

    fn add(self, _rhs: Bar) -> FooBar {
        println!("> Foo.add(Bar) was called");

        FooBar
    }
}

#[derive(Debug)]
struct  BarFoo;

impl ops::Add<Foo> for Bar {
    type Output = BarFoo;

    fn add(self, _rhs: Foo) -> BarFoo {
        println!("> Bar.add(Foo) was called");

        BarFoo
    }
}

pub fn main() {
    println!("Foo: {:?}", Foo);
    println!("Bar: {:?}", Bar);
    println!("Foo + Bar = {:?}", Foo + Bar); 
    println!("Bar + Foo = {:?}", Bar + Foo); 
}
